#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>

int main()
{
    int a = 1;
    pid_t pid = fork();
    if(pid == 0)
    {
        a++;
        printf("I am a child process,pid is %d,ppid is %d,a is %d,a address is %p \n",
        getpid(),getppid(),a,&a);
    }
    else if(pid)
    {
        a+=2;
        printf("I am a parent process,pid is %d,ppid is %d,a is %d,a address is %p \n",
        getpid(),getppid(),a,&a);
    }
    else
    {
        perror("fork error");
        exit(1);
    }
    return 0;
}